import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'layOut',
    components: {
      default: () => import('../views/layOut/index.vue')
    },
    children: [
      // 笔记
      {
        path: 'noteword',
        name: 'noteWord',
        components: {
          default: () => import('../views/noteWord/index.vue')
        }
      },
      // 技术分享
      {
        path: 'sharing',
        name: 'sharing',
        components: {
          default: () => import('../views/sharing/index.vue')
        }
      },
      // 日常
      {
        path: 'life',
        name: 'life',
        components: {
          default: () => import('../views/life/index.vue')
        }
      },
      // 好朋友们
      {
        path: 'myfriend',
        name: 'myFriend',
        components: {
          default: () => import('../views/myFriend/index.vue')
        }
      },
      // 关于
      {
        path: 'about',
        name: 'about',
        components: {
          default: () => import('../views/about/index.vue')
        }
      }
    ]
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFuntd404',
    components: {
      default: () => import('../views/NotFuntd404/index.vue')
    }
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
